<?php $imagePath = $this->baseUrl()."/RichTextEditor/image"; ?>
     <table border="0" cellpadding="0" cellspacing="1" bgcolor="#e1f2ff">
        <tr height="20">
            <td>
            &nbsp;
            <img src="<?php echo $imagePath;?>/bold.gif" title="Bold" onclick="doFormat('bold');">
            <img src="<?php echo $imagePath;?>/italic.gif" title="Italic" onclick="doFormat('italic');">
            <img src="<?php echo $imagePath;?>/underline.gif" title="Underline" onclick="doFormat('underline');">
            <img src="<?php echo $imagePath;?>/image.gif" title="Insert Image" onclick="insertImage();">
            <img src="<?php echo $imagePath;?>/link.gif" title="Hyperlink" onclick="addLink();">
            <img src="<?php echo $imagePath;?>/removeformatting.gif" title="Remove Formatting" onclick="unformat();"> 
            <input type="button" onclick="ReadMore()" value="Readmore seperate"/> 
            </td>

        </tr>
        <tr>
            <td align="center" bgcolor="#ffffff">
    <iframe id="textArea" style="width:500px;height:240px;overflow:auto;"></iframe>
            </td>
        </tr>
        <tr><td><input type="hidden" id="myContentID" name="mycontent"/></td></tr>
    </table>
    
<script type="text/javascript">
var editor = document.getElementById('textArea').contentWindow.document;
	editor.designMode='On';
  editor.open();
  editor.write('<html><head></head><body></body></html>');
  editor.close();
        
function doFormat(a,b){
  if(editor.queryCommandEnabled(a)){
    if(!b){b=null;}
        editor.execCommand(a,false,b);
  }
}
function addLink(){
  var aLink=prompt('Enter a link :', '');
    if(aLink){
        doFormat('CreateLink',  aLink);
    }
}
function insertImage(){
 document.getElementById('textArea').contentWindow.focus();
  var aLink=prompt('Enter an image URL :', '');
    if(aLink){
        doFormat('InsertImage',  aLink);
    }
}
function unformat(){
    doFormat('removeformat');
    doFormat('unlink');
}

function ReadMore()
{
	var content = this.editor.body.innerHTML;
	if(content.search('<hr>')==-1)
	{
		doFormat('inserthorizontalrule');
	}
	else
	{
		alert('Existed a READMORE SEPERATOR in this article');
	}
}

function getContentToHiddenInput(){
    document.getElementById('myContentID').value=this.editor.body.innerHTML;
}

function setContentForRichTextbox(content){
	this.editor.body.innerHTML=content;
}
    </script>  
